package com.koala;


import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import org.junit.jupiter.api.Test;

import java.io.FileWriter;
import java.io.IOException;

/**
 * @author yantingrui
 * @date 2022/4/14   14:00
 */
public class Start2 {

    String path = "D://a.txt";
    String format = "insert into publish_policy_user (phone, policy_id, created_by, updated_by) values (%s,9,'root','root');";
    String phones = "18770093038,13305630686,18258885249,18767105851,18809183423,18969181617,15623799211,13725077989,18271870163,13297078041,18966483409,18969195017,18258885249,15972909028,18100197503";

    /**
     *
     */
    @Test
    public void test19() throws IOException {
        FileWriter fileWriter = new FileWriter(path);
        String[] items = phones.split(",");
        for (String item : items) {
            String res = String.format(this.format, item);
            fileWriter.append(res);
            fileWriter.append("\n");
        }
        fileWriter.flush();
        fileWriter.close();
    }

    /**
     *
     */
    @Test
    public void test13() {
        HttpResponse execute = HttpRequest.get("https://restapi.amap.com/v3/ip?key=402de6255174a96092d572491d0c0368&ip=202.14.88.0&sig=ecb2bdcbe2b58387cfc685d60e153595").execute();
        if (execute.isOk()) {
            System.out.println(execute.body());
        }
    }
}
